

<?php
//detail page that shows all ayas related to a cat in an easy to read form
include 'settings.php';


$thiscat=$_GET['category'];

$con=mysqli_connect($host,$dbuserR,$dbpassR,$dbname);

//$con=mysqli_connect("localhost","quran","quran","Quran");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$qr="Select Description from Category where CIndex='".$thiscat."';";
$result=mysqli_query($con,$qr);


while($row = mysqli_fetch_array($result)) 
{
//echo "<div id='QuranTitle'>";
//echo $row['Description']."<br><br><br>";
$title="ايات القران التي تتكلم عن: ".$row['Description'];
//echo $title."<br><br>";
//echo "</div>";

}
include 'header.php';
//echo "</div>";
echo "<div id='QuranTitle'>";
echo $title."<br><br>";
echo "</div>";
echo "<a href='/categories.php'>الرجوع لجميع التصنيفات لأيات القرأن</a>";
$qr="Select quran_text2.sura,quran_text2.aya,quran_text2.text,suranames.name  from suranames,CategoryAya,quran_text2 where CategoryAya.Banned=0 and quran_text2.sura=suranames.number and  quran_text2.index=CategoryAya.AyaIndex and CategoryAya.CategoryIndex='".$thiscat."' order by quran_text2.index";
//$qr="Select quran_text2.sura,quran_text2.aya,quran_text2.text as text from CategoryAya,quran_text2 where quran_text2.index=CategoryAya.AyaIndex and CategoryAya.CategoryIndex='".$thiscat."' ";
//echo $qr;
$result=mysqli_query($con,$qr);

echo "<div id='Quran'>";
while($row = mysqli_fetch_array($result)) 
{

//echo ("<a href='category.php?".$row['CIndex']."'>");
//echo $row['Description']." (".$row['countrow'].")<br>\n</a>";
if ($lastsura<>$row['sura'] and $lastsura<>0) echo "<br>=========================================<br>";
if ($lastsura<>$row['sura'] ) echo "<br>".$row['name']."<br>";

if ($lastsura==$row['sura'] and $lastaya<>0 and $row['aya']>$lastaya+1) echo "<br><br>";
echo $row['text']." (".$row['aya'].") ";


$lastsura=$row['sura'];
$lastaya=$row['aya'];

}


echo "</div>";
















?> 

<?php include 'footer.php'; ?>
